package com.sc.nft.entity.vo;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
public class ArticleDetailsVO {

    @ApiModelProperty(value = "文章标题")
    private String title;

    @ApiModelProperty(value = "文章封面")
    private String cover;

    @ApiModelProperty(value = "简介")
    private String introduction;

    @ApiModelProperty(value = "内容")
    private String content;

    @ApiModelProperty(value = "MP3/MP4格式封面or头像")
    private String videosImg;

    @ApiModelProperty(value = "MP3/MP4格式播放地址")
    private String videosUrl;

    @ApiModelProperty(value = "文件大小(是kb就是kb,是mb就是mb)")
    private String videosSize;

    @ApiModelProperty("作者昵称")
    private String nickName;

    @ApiModelProperty("作者头像")
    private String creatorAvatarImg;

    @ApiModelProperty(value = "观看人数")
    private String watchSum;

    @ApiModelProperty(value = "音频后缀类型 0:文章 1:视频 2:音频")
    private Integer audioType;

    @ApiModelProperty("文章附件")
    private List<ArticleMaterialVO> articleMaterial;

    public void setWatchSum(String watchSum) {
        Integer sum = 100000;
        if (Convert.toInt(watchSum) <= sum) {
            this.watchSum = watchSum;
        } else {
            this.watchSum = StrUtil.format("{}w+", Convert.toInt(watchSum)/10000);
        }
    }

}
